package com.platform.usercenter.domain;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

import cn.hutool.core.collection.CollectionUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.platform.usercenter.service.TreeAdapter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.platform.common.core.annotation.Excel;
import com.platform.common.core.web.domain.BaseEntity;

/**
 * 组织上下游关系对象 sys_app_scene
 *
 * @author platform
 * @date 2024-10-28
 */
public class SysAppScene extends BaseEntity  implements TreeAdapter
{
    private static final long serialVersionUID = 1L;

    /** 主键 */
    private Long appSceneId;

    /** 父场景id */
    @Excel(name = "父场景id")
    private Long parentId;

    /** 应用场景名称 */
    @Excel(name = "应用场景名称")
    private String sceneName;

    /** 层级关系 */
    @Excel(name = "层级关系")
    private String levelSceneName;

    /** 应用场景编码 */
    @Excel(name = "应用场景编码")
    private String sceneCode;

    /** 是否删除(Y,N) */
    @Excel(name = "是否删除(Y,N)")
    private String isDelete;

    /** 删除人 */
    @Excel(name = "删除人")
    private String deleteBy;

    /** 删除时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date deleteTime;

    /**
     * 子应用场景
     */
    private List<SysAppScene> children = new ArrayList<>();


    public String getLevelSceneName() {
        return levelSceneName;
    }

    public void setLevelSceneName(String levelSceneName) {
        this.levelSceneName = levelSceneName;
    }

    public List<SysAppScene> getChildren() {
        return children;
    }

    public void setChildren(List<SysAppScene> children) {
        this.children = children;
    }

    public void setAppSceneId(Long appSceneId)
    {
        this.appSceneId = appSceneId;
    }

    public Long getAppSceneId()
    {
        return appSceneId;
    }
    public void setParentId(Long parentId)
    {
        this.parentId = parentId;
    }

    public Long getParentId()
    {
        return parentId;
    }
    public void setSceneName(String sceneName)
    {
        this.sceneName = sceneName;
    }

    public String getSceneName()
    {
        return sceneName;
    }
    public void setSceneCode(String sceneCode)
    {
        this.sceneCode = sceneCode;
    }

    public String getSceneCode()
    {
        return sceneCode;
    }
    public void setIsDelete(String isDelete)
    {
        this.isDelete = isDelete;
    }

    public String getIsDelete()
    {
        return isDelete;
    }
    public void setDeleteBy(String deleteBy)
    {
        this.deleteBy = deleteBy;
    }

    public String getDeleteBy()
    {
        return deleteBy;
    }
    public void setDeleteTime(Date deleteTime)
    {
        this.deleteTime = deleteTime;
    }

    public Date getDeleteTime()
    {
        return deleteTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("appSceneId", getAppSceneId())
            .append("parentId", getParentId())
            .append("sceneName", getSceneName())
            .append("sceneCode", getSceneCode())
            .append("remark", getRemark())
            .append("isDelete", getIsDelete())
            .append("deleteBy", getDeleteBy())
            .append("deleteTime", getDeleteTime())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }

    @Override
    public Long getTreeCurrentId() {
        return appSceneId;
    }

    @Override
    public Long getTreeParentId() {
        return parentId;
    }

    @Override
    public <T> void setTreeChildren(List<TreeAdapter> list, Class<T> clazz) {
        if (this.getClass().isAssignableFrom(clazz) && CollectionUtil.isNotEmpty(list)) {
            List<SysAppScene> collect = list.stream().map(SysAppScene.class::cast).collect(Collectors.toList());
            this.setChildren(collect);
        }
    }
}
